﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewUsers
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    

 
    <h2 class="textheadings" style="padding-top:5px;">View Users</h2>
    <table style="width:100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <th scope="col" style="padding-right:20px">
                User Name
            </th>
            <th scope="col">
                First Name
            </th>
            <th scope="col">
                Last Name
            </th>
            <th scope="col">
                Email
            </th>
            <th scope="col">
                User's Role
            </th>
            <th scope="col" style="width:13%">
                Manage Users
            </th>
        </tr>
         <%bool oddEven = true; %>
        <% foreach (var item in Model)
           {
          %>    
        <tr class="<%= (oddEven = !oddEven) ? "even" : "odd" %>">
            <td class="normaltds" >
                <%: item.username %>
                <%--<%: item.roleName %>--%>
            </td>
            <td class="normaltds" >
                <%: item.firstName %>
            </td>
            <td class="normaltds" >
                <%: item.lastname %>
            </td>
            <td class="normaltds" >
                <%: item.email %>
            </td>
            <td class="normaltds" >
                <%: item.roleName %>
            </td>
        
            <td class="normaltds" width="15%">
                <a href="<%= Url.Action("ViewUser", new{customUserId = item.customUserId})%>">
                    <img src="../../../Content/images/userEdit.png" border="0" alt="Edit User" title="Edit User" /></a>
                <a href="<%= Url.Action("ViewUser", new{username = item.username})%>" onclick="return confirm('Are you sure you want to Deactivate?')">
                    <img src="../../../Content/images/userRemove.png" border="0" alt="Deactivate User" title="Deactivate User" /></a>
                <a href="<%= Url.Action("ResetPasswordbyAdmin", "LogOn", new{userName = item.username})%>" onclick="return confirm('Are you sure you want to reset the password of this User?')">
                    <img src="../../../Content/images/userReset.png" border="0" alt="Reset Password" title="Reset Password" /></a>
                 <% MembershipUser mUser = Membership.GetUser(item.username);
                        if (mUser != null)
                        {
                            if (mUser.IsLockedOut)
                            { %>
                                <a href="<%= Url.Action("UnlockUser", "UserMgt", new{userName = item.username})%>" >
                                <img src="../../../Content/images/Unlock.gif" border="0" alt="Unlock User" title="Unlock User" /></a>
                    
                           <% }
                           

                        }
                 %>

            </td>
        </tr>
        <% } %>
    </table>
    <br />
    <%= Html.Pager((IPagination)(Model as IEnumerable<com.IronOne.NTB.Controllers.Models.UserMgt.UserMgtModelsMetadata>))%>
    <br />
    <div class="buttons" >
        <input type="submit" onclick="parent.location='<%: Url.Action("ViewUser", "UserMgt") %>';return false;"
            value="Add User" class="button" />
    </div>
    <div id="ftr" style="margin-bottom:80px;"></div>

</asp:Content>
